# Contributor: Milan P. Stanić <mps@arvanta.net>
# Maintainer: Milan P. Stanić <mps@arvanta.net>
pkgname=eiwd
_realpkgname=iwd
pkgver=2.10
pkgrel=0
pkgdesc="Internet Wireless Daemon without dbus"
url="https://github.com/illiliti/eiwd"
arch="all"
license="LGPL-2.1-or-later"
depends="!iwd"
replaces="iwd"
options="!check" # doesn't work because of eapol issue
makedepends="linux-headers autoconf automake libtool coreutils"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://github.com/illiliti/eiwd/releases/download/$pkgver-1/iwd-$pkgver.tar.xz
	eiwd.initd
	main.conf
	eiwd.post-upgrade
	iwd_passphrase
	"
builddir="$srcdir/iwd-$pkgver"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--disable-systemd-service \
		--disable-dbus
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -m750 -d "$pkgdir"/var/lib/$_realpkgname
	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/main.conf \
		"$pkgdir"/etc/$_realpkgname/main.conf
	install -m755 -D "$srcdir"/iwd_passphrase \
		"$pkgdir"/usr/bin
}

sha512sums="
829a712947ed8de7cd1f13fb67238a65e25cb08ef5c5c135809d2c7f5e771f749c31df732b6baa42b9f6c582968963df4d5077d65471cbe272f17428bd5cc7c7  iwd-2.10.tar.xz
cf4eca6baaf75cf345a4f8f13d27da65780ad67b64aa42b89b45199279b1ef794af0d28df952530bb7816ff2903801973f0592e8edc42ec221e6b49c7738edec  eiwd.initd
33517c2c72c43440ed2e68e53bb937d7d557efdf19a6f7fa9cceb87be4b64499f8b9bd6f981f5e413dc3d724eb13ec08b50a129dd81cf64872c362fc5e1d1321  main.conf
414cb08e01735a66dfb57eac7f308ce75f8f7adf679c5e38418293a0acb2398f9b4df4dd50a6756e48eb03b86de1546e2f852a28677842f2c453a0db86d49f71  eiwd.post-upgrade
06d0258e9e4d13a5cd7cb47cc30c122e2ea950c84b18352fef4982bef41961295316de396b7e6d0a33b949436da40d08fdd76230c7c228d8bdd0e33751cad26c  iwd_passphrase
"
